﻿<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

    <script type='text/html' template>
        <input type='hidden' name='PID' value="{{ d.params.PID || '' }}" />
    </script>
    <div class='layui-form-item'>
        <label class='layui-form-label'>类别名称</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='TypeName' value='{{ d.params.TypeName || '' }}' lay-verify='required' placeholder='类别名称' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <!--<div class='layui-form-item'>
        <label class='layui-form-label'>文章类别</label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <select readonly='readonly' name='Type_Sel'>
                        <option value='0' {{ d.params.Type_Sel == '0' ? 'selected' : '' }}>文章</option>
                        <option value='1' {{ d.params.Type_Sel == '1' ? 'selected' : '' }}>列表</option>
                    </select>
                </script>
            </div>
        </div>
    </div>

    <div class='layui-form-item'>
        <label class='layui-form-label'>文章分类</label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.getSelSource(d.params,"ParentID_SelSource");'>
                    <select name='ParentID_SelSource' readonly='readonly' id='ParentID_SelSource' lay-search></select>
                </script>
            </div>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>跳转地址</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='Href' value='{{ d.params.Href || '' }}' lay-verify='required' placeholder='跳转地址' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>-->
    <div class='layui-form-item'>
        <label class='layui-form-label'>备注</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='Comment' value='{{ d.params.Comment || '' }}' lay-verify='required' placeholder='备注' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <div class='layui-form-item'>
        <label class='layui-form-label'>排序</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' readonly='readonly' name='Order' value='{{ d.params.Order || '' }}' lay-verify='required|number' placeholder='排序' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
    <!--<div class='layui-form-item'>
        <label class='layui-form-label'>横向广告</label>
        <div class='layui-input-inline'>
            <script type='text/html' template lay-done='layui.data.setUpload(d);'>
                <input type='text' readonly='readonly' name='path1_Upload' id='path1_Upload' value='{{ d.params.path1_Upload || '' }}' lay-verify='required' placeholder='请上传图片' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <div class='layui-input-inline layui-btn-container' style='width: auto;'>
            <button class='layui-btn layui-btn-primary' layadmin-event='path1_UploadImg'>查看图片</button>
        </div>
    </div>

    <div class='layui-form-item'>
        <label class='layui-form-label'>左侧广告广告</label>
        <div class='layui-input-inline'>
            <script type='text/html' template lay-done='layui.data.setUpload(d);'>
                <input type='text' readonly='readonly' name='path2_Upload' id='path2_Upload' value='{{ d.params.path2_Upload || '' }}' lay-verify='required' placeholder='请上传图片' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <div class='layui-input-inline layui-btn-container' style='width: auto;'>
            <button class='layui-btn layui-btn-primary' layadmin-event='path2_UploadImg'>查看图片</button>
        </div>
    </div>

    <div class='layui-form-item'>
        <label class='layui-form-label'>是否网站显示</label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <select readonly='readonly' name='IsShow_Sel'>
                        <option value='0' {{ d.params.IsShow_Sel == '0' ? 'selected' : '' }}>显示</option>
                        <option value='1' {{ d.params.IsShow_Sel == '1' ? 'selected' : '' }}>不显示</option>
                    </select>
                </script>
            </div>
        </div>
    </div>-->

    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" onclick="Close()" value="关闭" class="layui-btn">
        </div>
    </div>
</div>

<script type="text/javascript">

    function Close() {
        layer.closeAll();
    }
    layui.use(['form','admin','upload'], function () {
        var form = layui.form;//required（必填项）phone（手机号）email（邮箱）url（网址）number（数字）date（日期）identity（身份证） 自定义值
    });


    layui.data.getSelSource = function (d,sourceName) {
            var $ = layui.$;
            var form = layui.form;
            var admin = layui.admin;

            if (sourceName == "ParentID_SelSource") {
                admin.req({
                    url: layui.setter.APIUrl + '/admin/articletypeMgr/customerQuery', //实际使用请改成服务端真实接口
                    type: 'post',
                    done: function (res) {
                        //$("#ParentID_SelSource").append("<option value=''>全部</option>");
                        layui.each(res.Data, function (index, eachdata) {
                            var strIsSel = '';
                            if (eachdata.PID == d.ParentID_SelSource)
                                strIsSel = "selected='selected'";
                            $("#ParentID_SelSource").append("<option value='" + eachdata.PID + "' " + strIsSel + ">" + eachdata.TypeName + "</option>");
                        });
                        form.render('select');
                    }
                });
            }

    }


    layui.data.setUpload = function (d) {
            var $ = layui.$,
            upload = layui.upload,
            admin = layui.admin;
            var formSelects = layui.formSelects;

            //上传头像
            var path1_UploadSrc = $('#path1_Upload');
            upload.render({
                url: '/file/uploadImg/'
              , elem: '#path1_UploadBtn'
              , accept: 'images'
              , method: 'get'
              , multiple: true
              , acceptMime: 'image/*'
              , done: function (res) {
                  if (res.ResultCode == 0) {
                      path1_UploadSrc.val(res.Data.src);
                      layer.msg('上传成功');
                  } else {
                      layer.msg(res.msg);
                  }
              }
            });

            //查看图片
            admin.events.path1_UploadImg = function (othis) {
                var src = path1_UploadSrc.val();
                layer.photos({
                    photos: {
                        "title": "查看头像" //相册标题
                      , "data": [{
                       "src": src //原图地址
                      }]
                    }
                  , shade: 0.01
                  , closeBtn: 1
                  , anim: 5
                });
            };

            //上传头像
            var path2_UploadSrc = $('#path2_Upload');
            upload.render({
                url: '/file/uploadImg/'
              , elem: '#path2_UploadBtn'
              , accept: 'images'
              , method: 'get'
              , multiple: true
              , acceptMime: 'image/*'
              , done: function (res) {
                  if (res.ResultCode == 0) {
                      path2_UploadSrc.val(res.Data.src);
                      layer.msg('上传成功');
                  } else {
                      layer.msg(res.msg);
                  }
              }
            });

            //查看图片
            admin.events.path2_UploadImg = function (othis) {
                var src = path2_UploadSrc.val();
                layer.photos({
                    photos: {
                        "title": "查看头像" //相册标题
                      , "data": [{
                       "src": src //原图地址
                      }]
                    }
                  , shade: 0.01
                  , closeBtn: 1
                  , anim: 5
                });
            };

    }



</script>
